package com.lipaluma.xml.validator;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import com.lipaluma.field.validator.ValidatorFactory;
import com.lipaluma.field.validator.strategies.LengthStrategy;

@XmlRootElement(name=XmlLengthValidator.LENGTH)
@XmlAccessorType(XmlAccessType.FIELD)
public class XmlLengthValidator implements XmlValidator {
	public static final String LENGTH = "length";
	
	@XmlAttribute(required=true)
	private int value;
	@XmlAttribute(name="strategy")
	private LengthStrategy lengthStrategy;
	
	@Override
	public String getFunctionValidation() {
		return ValidatorFactory.VALIDATION_LENGTH_FUNCTION;
	}
	public int getValue() {
		return value;
	}
	public LengthStrategy getLengthStrategy() {
		return lengthStrategy;
	}
}
